#!/bin/bash
set -ex

pear upgrade --force PEAR || true
pecl channel-update pecl.php.net

apt-get update && apt-get install -y \
    git zip unzip libicu-dev libzip-dev libonig-dev libxml2-dev \
    libssl-dev libpng-dev libjpeg-dev libfreetype6-dev libcurl4-openssl-dev \
    libsqlite3-dev libxslt-dev zlib1g-dev libaio-dev libpcre3-dev pkg-config \
    re2c bison autoconf libfreetype6-dev \
    && rm -rf /var/lib/apt/lists/*

docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/

docker-php-ext-install \
    bcmath curl fileinfo ftp gd intl mbstring \
    mysqli pdo pdo_mysql pdo_sqlite pcntl shmop sockets sysvsem tokenizer xml xmlrpc soap

yes '' | pecl install mongodb-1.16.6
yes '' | pecl install msgpack-2.2.2
yes '' | pecl install redis-5.3.8
yes '' | pecl install swoole-4.8.13
yes '' | pecl install yar-2.3.5

yes '' | pecl install raphf-2.0.1
docker-php-ext-enable raphf
yes '' | pecl install propro-2.1.0
docker-php-ext-enable propro
yes '' | pecl install pecl_http-3.2.5

docker-php-ext-enable mongodb msgpack redis swoole yar http